<?php

namespace App\Models\miniapp;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Goods extends Model
{
    use HasFactory;
    public $table = 'miniapp_goods';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'cid',
        'title',
        'image',
        'price',
        'stock',
        'description',
        'content',
        'is_sale',
        'is_recommend',
        'orderby',
    ];

    public function category()
    {
        return $this->belongsTo(Category::class, 'cid', 'id');
    }
}
